// geacosta
updateParametros = function(element, value, patrones)
{
      
     var patr = "";
     if(patrones != null)
     {
        for(var p in patrones)
        {
               if($(patrones[p]) != null)
               {
                    patr += "&patron["+p+"]="+$(patrones[p]).value;
                    }
                else
                {
                  var val =   patrones[p].split("="); 
                patr += "&patron["+p+"]="+val[1];
                }
                
        }
     }
      return patr;
}


/**
 *  Cierra el wincombo actual.
 *
 */   
cerrarWincombo = function()
{
    Windows.close("wincombo");
}

wincombo = function(id, opcion, criterios)
{
    valor_campo = document.getElementById(id).value;
    url_request = "wincombo/index?opcion="+opcion+criterios;
    options_request = {asynchronous:true, evalScripts:true, method:'GET'};
    Dialog.alert({ url: url_request, options: options_request }, 
                 { id:"wincombo", hideEffect: Element.hide, showEffect: Element.show, className: "alphacube", width:540, height: 470, okLabel: "Cerrar", zIndex: 1000 });
}

limpiarWincombo = function(indices)
{       
    for(var key=0; key < indices.length; key++)
    {

        element = document.getElementById(indices[key]);
        if(element)
        if(element.tagName == 'DIV')
        {
            element.innerHTML = "";
        }else
            element.value = "";
    }
}


function actualizarInformacion(div_id, valor, module)
{
	new Ajax.Updater({success:div_id, failure:'div_error'}, module+'/obtenerInformacion?id='+valor, {asynchronous:true, evalScripts:true, method:'GET' });

}
obtenerMenuesPorGrupo = function(div_id, valor, module)
{
alert("obtenerMenuesPorGrupo");
  new Ajax.Updater({success:div_id, failure:'div_error'}, module+'/obtenerInformacion?id='+valor+"&grupo_id="+$('grupo_id').value, {asynchronous:true, evalScripts:true, method:'GET' });

}
descargarDatos = function (arreglo)
{
	element = $(indices[0]);
	element.value = arreglo[0] ;
	
	element1 = $(indices[1]);
	element1.value = arreglo[1] ;
	for(var key=2; key < indices.length; key++)
	{
		// alert(String(indices[key])+ ' -- '+arreglo[key]);
		if(String(indices[key]) != 'undefined')
		{
			element2 = $(indices[key]);
                        if(element2)
			if(String(element2.tagName) == "DIV")
			{
			    if(element2.getAttribute('funcion'))
			    {
			         func = element2.getAttribute('funcion');
                    eval(func+"('"+element2.id+"', "+arreglo[0]+", '"+element2.getAttribute('modulo')+"')");
                }else
				actualizarInformacion(element2.id, arreglo[0], element2.getAttribute('modulo'));
			}else
			{
				element2.value = arreglo[key] ;
			}
		}
	}
	cerrarWincombo();
}





